package appapi.Global;

import appapi.common.ResponseBean;
import appapi.common.ResponseCodeEnum;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 请求对象
 *
 * @author luocheng
 * @version 1.0
 * @date 2023/05/20 14:58
 */
@RestControllerAdvice
public class GlobalExceptionConfig {
    @ExceptionHandler(BusinessException.class)
    public ResponseBean<BusinessException> handle(BusinessException e) {
        e.printStackTrace();
        return ResponseBean.fail(e.getCode(), e.getMessage());
    }
}
